// 用户请求相关模块
// import request from '@/utils/request'
// // 用户登录
// export const login = data => request({
//   method: 'POST',+

//   url: '/v1_0/authorizations',
//   data
// })
// import request from '@/utils/request'
// export const login = data => request({
//   method: 'POST',
//   url: '/v1_0/authorizations',
//   data
// })
import request from '@/utils/request'

// 用户登录
// export const login = data => request({
//   method: 'POST',
//   url: '/v1_0/authorizations',
//   data
export const login = data => request({
  method: 'POST',
  url: '/v1_0/authorizations',
  data
})
// 获取验证码
// export const sendSms = mobile => request({
//   method: 'GET',
//   url: `/v1_0/sms/codes/${mobile}`
// })
export const sendSms = mobile => request({
  method: 'GET',
  url: '/v1_0/authorizations'
})
// 获取用户信息
export const getUserInfo = () => request({
  method: 'GET',
  url: '/v1_0/user'
  // headers: {
  //   Authorization: `Bearer ${store.state.user.token}`
  // }
})
// 获取用户频道信息
export const getUserChannels = () => request({
  method: 'GET',
  url: '/v1_0/user/channels'
})

export const addFollow = userId => {
  return request({
    method: 'POST',
    url: '/v1_0/user/followings',
    data: {
      target: userId
    }
  })
}

/**
 * 取消关注
 */
export const deleteFollow = userId => {
  return request({
    method: 'DELETE',
    url: `/v1_0/user/followings/${userId}`
  })
}

export const getUserProfile = target => {
  return request({
    method: 'GET',
    url: '/v1_0/user/profile'
  })
}

export const updateUserProfile = data => {
  return request({
    method: 'PATCH',
    url: '/v1_0/user/profile',
    data
  })
}

export const updateUserPhoto = data => {
  return request({
    method: 'PATCH',
    url: '/v1_0/user/photo',
    data
  })
}